fix(exports): verify every reported artifact - #270
Conversation
|
#266 is merged and covers this branch's |
|
The premise here — a reported artifact must exist and be non-empty — holds up KiCad 10.0.4, its own bundled A leaf sheet yields one file; a root with children yields one per sheet.
This is kicad-cli's own asymmetry rather than anything on this side: PDF puts every sheet in one document; SVG cannot, so it takes a directory and Worth folding into this PR? Verifying the child files means enumerating them, |
|
Second reminder, with an offer: this branch still carries both the old #269-content commit (now redundant — #285 landed the consolidated option work) and the artifact-verification commit, and GitHub marks it CONFLICTING. If you'd rather not do the rebase, say so and I'll do it on the fork this week — the #252 verification core is wanted and shouldn't rot here. anyn99's hierarchical-SVG multi-file question from review will also need an answer either way. |
|
I tested the proposed salvage path against current What I found rebasing itI transplanted only
After resolving those, the test build still fails because the old artifact-verification test calls the removed So this is manageable, but it is not a safe automatic "update branch" operation. One correctness gap worth fixing before this lands
A reused destination can therefore return a false success:
The fresh-temp-directory tests do not exercise this case. Gerber/drill enumeration is especially exposed because it scans an existing directory after the command. I recommend making freshness structural rather than relying on timestamps:
That directly enforces #252's rule that a response is derived from the current result rather than the requested path. Scope boundaryI would leave hierarchical SVG filename/multi-file behavior to #291. Solving it here changes the response shape and overlaps its explicit design. For this PR/replacement, either omit the schematic-SVG extension or verify only the existing contract without claiming the hierarchy problem is solved. The critical fake-CLI tests are currently Unix-only. Since the original phantom-path report came from Windows and Windows CI is available, a cross-platform fake-CLI harness or Windows equivalent would make this materially safer. Suggested way forwardMy preference is:
That gives the verification fix a reviewable history without force-rewriting an inactive contributor branch or carrying obsolete #251/#269 work. If you prefer using maintainer edits on this branch instead, the same changes apply. We can prepare the clean replacement after you choose the direction. |
|
Superseded by #427, which preserves @nordic-style's original artifact-verification commit and authorship while rebuilding the change on current main. The replacement adds current-invocation staging, stale-destination protection, cross-platform regressions, and real-KiCad evidence. Closing this older branch so there is one review target; its history and credit remain intact. |
Summary
kicad-cliexits successfullyCloses #252
Approach
The export boundary now enforces a shared postcondition: every advertised artifact must exist, be a regular file, and contain data. Gerber and drill exports additionally require the expected output set, while project snapshots propagate either schematic or PCB export failure instead of returning phantom paths.
Manufacturing packages now expose
complete; incomplete packages return an MCP error and omit upload instructions. The file list is assembled from verified paths rather than a raw directory scan, so stale or empty files cannot masquerade as current output.This PR is intentionally stacked on #269. Its first commit is the export-option implementation from that PR; after #269 merges, the remaining diff is the focused artifact-verification commit
cda33a3.Compatibility and rollback
snapshot_projectnow fails when either requested PDF is missing or empty. This is an intentional correction of false-success behavior.complete; partial packages useisError: trueand no longer include upload instructions.Validation
cargo test --workspace --locked --lib --tests: all new tests pass; the workspace reaches 555/558konnect-coretests, with only the same three pre-existing localupdate_symbols_from_library_*failures caused by the installed KiCadDevice:Rlibrary shadowing the test fixturecargo test --workspace --locked --doc: passcargo clippy --workspace --locked --all-targets -- -D warnings: passcargo fmt --all -- --check: passcomplete: true, 14 verified non-empty artifacts, including all 11 requested Gerber plots plus PTH and NPTH drill files